Ext.onReady(function(){
    Ext.QuickTips.init();
	 
    var loginPanel = new Ext.FormPanel({ 
		
        labelWidth:65,
        url:'./php/login.php', 
		bodyStyle:'padding:10px;',
        title: NOM_window_login, 
        width:230,
		keys:({
			key: Ext.EventObject.ENTER,
			fn: submit
		}), 		
        defaultType:'textfield',
		monitorValid:true,
		border:true,
        items:[{ 
                fieldLabel:'Login', 
                name:'login',
                allowBlank:false 
            },{ 
                fieldLabel:'Password', 
                name:'password',
                inputType:'password', 
                allowBlank:false 
            }],
			buttonAlign: 'center',
        buttons:[{ 
                text: BUTTON_enter,
                formBind: true,	
                handler: submit
            }] 
    });
	
	function submit(){
		if(loginPanel.getForm().isValid()){
			loginPanel.getForm().submit({ 
				method:'POST', 
				waitMsg: AJAX_wait,
				success:function(form,action){ 
					window.location = 'index.php';
				},
				failure:function(form, action){ 
					loginPanel.getForm().reset(); 
				} 
			}); 
		}
	}
    
    var win = new Ext.Window({
        layout:'fit',
        width:250,
        height:150,
        closable: false,
        resizable: false,
        plain: true,
		draggable: false,
        items: [loginPanel]
	});
	win.show();
});